- 
                Notifications
    You must be signed in to change notification settings 
- Fork 257
feat(jsii-reflect): add a jsii-query tool #4952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
`jsii-query` can be used for fine-grained queries on a JSII assembly.
```
jsii-query <FILE> [QUERY...]
Queries a jsii file for its entries.
Positionals:
  FILE   path to a .jsii file or directory to load                      [string]
  QUERY  a query or filter expression to include or exclude items       [string]
Options:
      --help     Show help                                             [boolean]
      --version  Show version number                                   [boolean]
  -t, --types    after selecting API elements, show all selected types, as well
                 as types containing selected members [boolean] [default: false]
  -m, --members  after selecting API elements, show all selected members, as
                 well as members of selected types    [boolean] [default: false]
  -c, --closure  Load dependencies of package without assuming its a JSII
                 package itself                       [boolean] [default: false]
REMARKS
-------
There can be more than one QUERY part, which progressively filters from or adds
to the list of selected elements.
QUERY is of the format:
    <op><kind>[:<expression>]
Where:
    <op>          The type of operation to apply
             +    Adds new API elements matching the selector to the selection.
                  If this selects types, it also includes all type's members.
             -    Removes API elements from the current selection that match
                  the selector.
             .    Removes API elements from the current selection that do NOT
                  match the selector (i.e., retain only those that DO match
                  the selector).
    <kind>        Type of API element to select. One of 'type' or 'member',
                  or any of its more specific sub-types such as 'class',
                  'interface', 'struct', 'enum', 'property', 'method', etc.
                  Also supports aliases like 'c', 'm', 'mem', 's', 'p', etc.
    <expression>  A JavaScript expression that will be evaluated against
                  the member. Has access to a number of attributes like
                  kind, ancestors, abstract, base, datatype, docs, interfaces,
                  name, initializer, optional, overrides, protected, returns,
                  parameters, static, variadic, type. The types are the
                  same types as offered by the jsii-reflect class model.
This file evaluates the expressions as JavaScript, so this tool is not safe
against untrusted input!
EXAMPLES
-------
Select all methods with "grant" in their name:
$ jsii-query node_modules/aws-cdk-lib --members '.method:name.includes("grant")'
```
    | Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! | 
| Merging (with squash)... | 
| This pull request has been removed from the queue for the following reason:  The merge conditions cannot be satisfied due to failing checks:You may have to fix your CI before adding the pull request to the queue again. | 
jsii-querycan be used for fine-grained queries on a JSII assembly.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.